package com.ljp.facade.impl;

import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.alibaba.fastjson.JSONObject;
import com.ljp.dao.model.User;
import com.ljp.facade.UserFacade;
import com.ljp.facade.beans.UserRequestDto;
import com.ljp.facade.beans.UserResponseDto;
import com.ljp.service.UserService;

/**
 * 用户信息
 * @author Administrator
 *
 */
@Service
public class UserFacadeImpl implements UserFacade{

	@Autowired
	private UserService userService;
	
	/**
	 * 根据用户id查询用户信息
	 * @param userRequestDto
	 * @return
	 */
	public UserResponseDto getUserInfo(UserRequestDto userRequestDto) {
		
		System.out.println("根据用户id查询用户信息    传入参数:"+JSONObject.toJSONString(userRequestDto));
		
		Integer id = userRequestDto.getId();
		
		User userIfo = userService.getUserIfo(id);
		
		System.out.println("查询结果："+JSONObject.toJSONString(userIfo));
		
		UserResponseDto result = new UserResponseDto();
		BeanUtils.copyProperties(userIfo, result);
		
		return result;
	}

}
